﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PageTemplateLib;
using System.Collections.Generic;

public partial class Article : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        PageTemplate pt = new PageTemplate();
        PageTemplate.SkinPath = @"templates";

        int id = 0;
        String ids = Request.QueryString["ID"];
        if (!String.IsNullOrEmpty(ids)) int.TryParse(ids, out id);
        //XCMSData.Title title = XCMSData.Title.FindByKey(id);
        IList<XCMSData.Title> title = XCMSData.Title.SelectAll(XCMSData.Title._.ID, id, 0, 1);
        pt.AddData("文章标题", title);
        pt.AddData("文章", title[0].Articles);
        pt.AddData("评论", title[0].Replys);

        IList<XCMSData.Board> bs = XCMSData.Board.SelectAllForIndex();
        pt.AddData("X_Board", bs);
        pt.AddData("公告栏", XCMSData.Title.SelectAllForBoard("公告", 10));
        pt.AddData("最新热点文章", XCMSData.Title.SelectTop(20));

        Response.Write(pt.GetTemplate("default", "_article_index"));

    }
}
